#!/bin/bash

g_Pro_SrcPath=$(pwd)/..
source $g_Pro_SrcPath/ComEchoType.sh

g_ProName="$1"
g_ChipName="$2"
$g_Pro_SrcPath/ComBuildFunc.sh $g_Pro_SrcPath $g_ProName $g_ChipName "ComProcess"
if [ $? -eq 0 ];then
    exit
else
    tool_strip=`cat $g_Pro_SrcPath/ToolStrip.txt`
fi

G_CURRENT_PATH=$(pwd)
mkdir -p build/$g_ChipName
cd build/$g_ChipName
cmake -Wno-dev -DCMAKE_TOOLCHAIN_FILE=$G_CURRENT_PATH/../IPC_Code/Cmake/$g_ChipName.cmake \
-DCHIP_TYPE=$g_ChipName -D$g_ChipName:BOOL=ON -D"ComProcess":BOOL=ON ../../
make -j4
if [ $? != 0 ];then
    sh_func_echo_err "make error"
    exit
fi

$tool_strip bin/*
chmod 777 bin/*
$g_Pro_SrcPath/ComBuildFunc.sh $g_Pro_SrcPath $g_ProName $g_ChipName "ComProcess" "s"
